<template>
    <div>
        <pre>
            test123() {
                 let arr1 = [1,2,3,4,5,6,7];
                let count = 0;
                arr1.forEach(a => {
                    if (a === 1 || a === 3 || a === 5 || a === 7) {
                        count++;
                    }
                });
                console.log(count);
                return count;
            }
        </pre>


        <p>数组中奇数个数为 {{test123([1,2,3,4,5,6,7])}}</p>

    </div>
</template>

<script>
    export default {
        name: "learn-es6-foreach",
        methods: {
            test123(arr1) {
                // let arr1 = [1,2,3,4,5,6,7];
                let count = 0;
                arr1.forEach(a => {
                    if (a === 1 || a === 3 || a === 5 || a === 7) {
                        count++;
                    }
                });
                console.log(count);
                return count;
            }
        },
        mounted() {
        }
    }
</script>

<style scoped>

</style>